<?php
include_once "conn.php";
$sql = "select * from car order by carnum desc";
$result = mysqli_query($conn,$sql);
/*$a['categories'] = ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"];
$a['data'] = [5, 20, 36, 10, 10, 20];*/
$a['categories'] = array();
$a['data'] = array();
while($info = mysqli_fetch_array($result)){
    //车辆名称：$info['carname']  车辆票数：$info['carnum']
    array_push($a['categories'],$info['carname']);
    array_push($a['data'],$info['carnum']);
}
echo json_encode($a);